#include <iostream>
#include <algorithm>

using namespace std;

const int N = 20;

int n, m;
int sum[N], w[N];
int ans = N;

void dfs(int u, int k) {
    if (k >= ans ) return ;
    if (u == n) {
        ans = k;
        return ;
    }
    
    for (int i = 0; i < k; ++ i)
        if (sum[i] + w[u] <= m) {
            sum[i] += w[u];
            dfs(u + 1, k);
            sum[i] -= w[u];
        }
    
    sum[k] = w[u];
    dfs(u + 1, k + 1);
    sum[k] = 0;
}

bool cmp(int a, int b) {
    return a > b;
}

int main() {
    cin >> n >> m;
    
    for (int i = 0; i < n; ++ i) scanf("%d", w + i);
    
    sort(w, w + n, cmp);
    
    dfs(0, 0);
    
    cout << ans << endl;
    
    return 0;
}